package com.glasses.controller;

import com.alibaba.fastjson.JSONObject;
import com.glasses.orm.base.Ex.BaseControllerEx;
import com.glasses.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 地址 controller
 * Created by ashin on 2018/8/21.
 */

@Controller
@Scope("prototype")
@RequestMapping("/address")
public class AddressController extends BaseControllerEx {

    @Autowired
    AddressService addressService;

    @Override
    protected void init() {
        super.init(addressService);
    }

    @RequestMapping(value = "/doUpdateDefault")
    public JSONObject doUpdateDefault(@RequestParam Map map) throws Exception{
        return addressService.updateDefault(map);
    }

    @RequestMapping(value = "/doAddAddress")
    public JSONObject doAddAddress(@RequestParam Map map) throws Exception{
        return addressService.addAddress(map);
    }

    @RequestMapping(value = "/doUpdateAddress")
    public JSONObject doUpdateAddress(@RequestParam Map map) throws Exception{
        return addressService.updateAddress(map);
    }

}
